<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>证书查询</title>
    <link href="css/index.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div class="container">
    <div class="contain">
        <div class="title">
            <p>证书查询</p>
        </div>
        <table>
            <tr>
                <td>姓名：</td>
                <td><input type="text" class="username"/></td>
            </tr>
            <tr>
                <td>证书编号：</td>
                <td><input type="text" class="number"/></td>
            </tr>
            <tr>
                <td>有效证件后六位：</td>
                <td><input type="text" class="idcard"/></td>
            </tr>
            <tr>
                <td colspan="2"><button type="button" class="search">查询</button></td>
            </tr>
            </table>

    </div>
</div>
<script src="js/jquery.js"></script>
<script>
    $(function () {
        $(".container").height($(window).height());
        $(".container table tr:not(:last)").each(function () {
            $(this).find("td:first").css("textAlign","right");
        });
        $(".container table tr:not(:last)").each(function () {
            $(this).find("td:last").css("textAlign","left");
        });
        $(".search").click(function () {
            $.ajax({
                url:"http://test.shitongyiwu.com/cert/cert/search",
                type:"post",
                dataType:"json",
                data:{username:$(".username").val(),number:$(".number").val(),idcard:$(".idcard").val()},
                success:function (data) {
                    if(data.type=="success"){
                        window.location.href="result.html";
                    }else {
                        alert(data.content);
                    }
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.status);
                    alert(XMLHttpRequest.readyState);
                    alert(textStatus);
                }
            });
        });
    });
</script>
</body>
</html>